def sort_each_item(l):
    r = []
    for i in l:
        il = list(i)
        il.sort()
        r.append(''.join(il))
    return r

def l2d(l):
    d = {}
    l = sort_each_item(l)

    for i in l:
        if not d.has_key(i):d[i] = 1
        else:
            d[i] = d[i] + 1
    return d
